<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/21
 * Time: 16:04
 */

namespace app\models;


use yii\db\Query;

/**
 *后台公告表
 */
class Announce extends BaseModel
{
    public function __construct()
    {
        $this->table = 'jingsourcing_announce';
    }

    public function all($where = [], $offset = false, $limit = false, $order = false)
    {
        $db = new Query();
        $db->select('*')->from($this->table);
        return $db->orderBy(['time' => SORT_DESC])->offset($offset)->limit($limit)->all();
    }

    public function size($where)
    {
        $db = new Query();
        $re = $db->select('count(*) as num')->from($this->table)->one();
        return $re ? $re['num'] : 0;
    }

    public function one($where = [])
    {
        // TODO: Implement one() method.
    }

}